<template>
    <div class="Login">
      <p>登录页面</p>
      <input type="text" placeholder="请输入帐号" v-model="userNumber">
      <input type="password" placeholder="请输入密码" v-model="pwd">
      <button @click="login">登录</button>
    </div>
</template>

<script>

export default {
  data(){
    return{
      userNumber:"",
      pwd:""
    }
  },
  methods:{
    login(){
      if(this.userNumber === "admin" && this.pwd === "123456"){
        const user = { userNumber: this.userNumber, pwd: this.pwd };
        localStorage.setItem('user', JSON.stringify(user));
        this.$router.push("/StudentSystem");
      }
      else
        alert("用户名或密码错误！")
    }
  }
}
</script>